Skip to content

Conversation

@MiguelGomezMaxio
Copy link

@MiguelGomezMaxio MiguelGomezMaxio commented Oct 28, 2025

Ticket

https://maxioevolution.atlassian.net/browse/PAY-2783

Related

https://github.com/maxio-com/chargify/pull/27000

What

We adding support for sending CEDP / Level 3 data to Stripe on each payment intent

How

Adjusting the creation of this piece of payload to comply with the new format, which is still on preview.

Notes

About the 2025-04-30.preview header

We’re now sending “payment line items” (Stripe’s new CEDP / Level 3-style data) when we create the PaymentIntent. This data goes in the payment_details[...] object (for example order_reference) and amount_details[line_items][...] (per-item info like product name, unit cost, quantity, tax). This feature is behind a public preview in Stripe, and Stripe requires that we send the preview API version header 2025-04-30.preview on the request so those params are accepted and persisted. See Stripe’s Payment line items preview docs, which say: “You can use this public preview feature by including the version header 2025-04-30.preview … You can now add the line items … by passing the payment_details and amount_details params when creating a PaymentIntent.”
https://docs.stripe.com/payments/payment-line-items
https://docs.stripe.com/changelog/basil/2025-04-30/payment-line-items

About the new key payment_method_types: ['card']

When we switched to that preview version, Stripe changed default behavior for payment methods. If you don’t tell Stripe which payment method types you want, Stripe will auto-enable every method you’ve turned on in the Dashboard. Some of those methods are redirect-based, so Stripe then requires a return_url on the PaymentIntent. To avoid that (we only charge cards, server-side, no redirects), we now explicitly send: post[:payment_method_types] = ["card"]

Stripe’s docs describe that you can either
(a) pass payment_method_types: ['card'] when creating the PaymentIntent, or
(b) force automatic_payment_methods[allow_redirects]=never, to prevent redirect methods and skip the return_url requirement.
https://docs.stripe.com/upgrades/manage-payment-methods
https://docs.stripe.com/changelog/2023-08-16/automatic-payment-methods


Note

Medium Risk
Changes the Stripe PaymentIntent/charge request payload to sometimes send new payment_details/amount_details fields and forces payment_method_types for card intents, which can affect payment behavior if options are set incorrectly. Also alters API version header selection via a new stripe_api_version option, impacting request compatibility.

Overview
Adds support for Stripe’s CEDP/payment line items by conditionally sending payment_details and amount_details (and explicitly setting payment_method_types: ["card"]) when creating PaymentIntents/charges for card-not-present transactions; otherwise it falls back to existing Level 3 level3 data.

Updates Stripe API version handling to prefer options[:stripe_api_version] over the legacy :version option so preview API versions can be requested per-call.

Written by Cursor Bugbot for commit 57c4797. This will update automatically on new commits. Configure here.

Copy link

@himn1 himn1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 comment

Copy link

@himn1 himn1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 comment

post[:amount_details] = options[:amount_details]
post[:payment_method_types] = ["card"]
@options.merge!(:version => '2025-04-30.preview')
options[:version] = options.dig(:stripe_level3_version)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just send it correctly from AB -> Conduit so we don't have to adjust it here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the point of modyfinging options here, in general?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@himn1 , I'll refactor this to grab the version from the information sent from AB.
I was doing this replacement because the version is taken from the options hash from within the #api_version method and I didn;t want to touch it.
And about the new version (2025-04-30.preview), this is needed because this CEDP feature is only working on that version within Stripe's api, so until they release it to the production one, we need to point the purchase method to that preview api version


def api_version(options)
options[:version] || @options[:version] || "2015-04-07"
options[:stripe_level3_version] ||options[:version] || @options[:version] || "2015-04-07"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format issue
||options.
reminder:
discuss with Curstor + GPT 5.2 before asking a human for review

Is this implementation optimal?
Is this in the most optimal place?
Check what we do in similar places

Copy link

@himn1 himn1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created sub PR where I did final refactoring
#246
familiarize and merge with your
then
adjust Conduit, AB to :stripe_api_version change


def api_version(options)
options[:version] || @options[:version] || "2015-04-07"
options[:stripe_level3_version] || options[:version] || @options[:version] || "2015-04-07"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI and me:
rename :stripe_level3_version to :stripe_api_version

Co-authored-by: himn1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants